<script type="text/javascript">
	$(document).ready(function(){
		$(".layout:even").each(function(){
			var heightLeft = $(this).height();
			var heightRight = $(this).next().height();
			if(heightLeft > heightRight){
				$(this).next().css('height',heightLeft);
			}else{
				$(this).css('height',heightRight);
			}
		});
		
		$(".layout:even:even").each(function(){
			$(this).addClass('even');
			$(this).next().addClass('even');
		});
		
		$(".layout:even:odd").each(function(){
			$(this).addClass('odd');
			$(this).next().addClass('odd');
		});
		
		$(".layout:odd").css('border','none');
	});
</script>
<div class="document">
	<div class="header-bar">
		<h1>เอกสารวิชาการ</h1>
	</div>
	<div class="content">
	<?php foreach($categories as $key=>$category):?>
		<div class="layout">
			<h2><?php echo lang_decode($category->name,'th')?></h2>
			<ul>
			<?php foreach($category->document as $document):?>
				<li><a href="documents/download/<?php echo $document->id?>"><?php echo lang_decode($document->title,'th')?></a></li>
			<?php endforeach;?>
			</ul>
			<br clear="all">
		</div>
	<?php endforeach;?>
	</div>
</div>